arr1 = list(input())
arr2 = list(input())


def sortString(arr):
    for i in range(0, len(arr)):
        for j in range(i + 1, len(arr)):
            if arr[i] < arr[j]:
                temp = arr[i]
                arr[i] = arr[j]
                arr[j] = temp


def isSame(arr1, arr2):
    for i in range(len(arr1)):
        if arr1[i] != arr2[i]:
            return False
    return True


if len(arr1) != len(arr2):
    print("NO")
else:
    sortString(arr1)
    sortString(arr2)
    if isSame(arr1, arr2):
        print("YES")
    else:
        print("NO")
